<?php // 4.0
class index {
  function loaddata() {
    global $masterclass;

    $masterclass->loadmodule('customers');
    $masterclass->loadmodule('personnel');
    $masterclass->loadmodule('invoices');

    $masterclass->loadmodule('invoices_wap',$masterclass->mainconfig['moduledirectory'].'invoices/invoices_wap.func.php');
    
    $masterclass->websiteconfig['title']='Invoices';
  return;
  }
  
  function savedata() {
    global $masterclass;
    
    foreach ($masterclass->sitevars['post_action'] as $postaction) {
      switch ($postaction) {
       case '':
       
      break;
      }
    }
     
  return;
  }
  
  function display() {
    global $masterclass;
  
    $strwhere=" (`active`='1') ";
    $listarray=$masterclass->fetch_records('invoices_documents',1,$strwhere,' `documentid` DESC ',40);
    for ($i=0;$i<count($listarray);$i++) {
      $invoicetotals=$masterclass->allclasses['invoices']->fetch_invoices_totals($listarray[$i]['id']);
      if (!empty($invoicetotals)) { $listarray[$i]=array_merge($listarray[$i],$invoicetotals); }
    }
    $listdata=$masterclass->allclasses['invoices_wap']->display_invoices($listarray,$masterclass->mainconfig['dir'].$masterclass->mainconfig['htmldirectory'].'invoices/invoice.php?'.$masterclass->trackingvar_query().'&invoicesid=',array('showname'=>'1'));
    echo $listdata['load_list'];
  
  return;
  }
}
?>
